home *** CD-ROM | disk | FTP | other *** search
- // AaxDlg.cpp : implementation file
- //
-
- #include "stdafx.h"
- #include "Aax.h"
- #include "AaxDlg.h"
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CAaxDlg dialog
-
- CAaxDlg::CAaxDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CAaxDlg::IDD, pParent)
- {
- m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
- }
-
- BEGIN_MESSAGE_MAP(CAaxDlg, CDialog)
- ON_WM_PAINT()
- ON_WM_QUERYDRAGICON()
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CAaxDlg message handlers
- BOOL CAaxDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- SetIcon(m_hIcon, TRUE); // Set big icon
- SetIcon(m_hIcon, FALSE); // Set small icon
-
- return TRUE; // return TRUE unless you set the focus to a control
- }
-
- void CAaxDlg::OnPaint()
- {
- if (IsIconic())
- {
- CPaintDC dc(this); // device context for painting
-
- SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
-
- // Center icon in client rectangle
- int cxIcon = GetSystemMetrics(SM_CXICON);
- int cyIcon = GetSystemMetrics(SM_CYICON);
- CRect rect;
- GetClientRect(&rect);
- int x = (rect.Width() - cxIcon + 1) / 2;
- int y = (rect.Height() - cyIcon + 1) / 2;
-
- // Draw the icon
- dc.DrawIcon(x, y, m_hIcon);
- }
- else
- {
- CDialog::OnPaint();
- }
- }
-
- // The system calls this to obtain the cursor to display while the user drags
- // the minimized window.
- HCURSOR CAaxDlg::OnQueryDragIcon()
- {
- return (HCURSOR) m_hIcon;
- }
-
- BEGIN_EVENTSINK_MAP(CAaxDlg, CDialog)
- ON_EVENT(CAaxDlg, IDC_AAXBUTTONCTRL_TOP, -600 /* Click */, OnClickTop, VTS_NONE)
- ON_EVENT(CAaxDlg, IDC_AAXBUTTONCTRL_BOTTOM, -600 /* Click */, OnClickBottom, VTS_NONE)
- ON_EVENT(CAaxDlg, IDC_AAXBUTTONCTRL_LEFT, -600 /* Click */, OnClickLeft, VTS_NONE)
- ON_EVENT(CAaxDlg, IDC_AAXBUTTONCTRL_RIGHT, -600 /* Click */, OnClickRight, VTS_NONE)
- END_EVENTSINK_MAP()
-
- void CAaxDlg::OnClickTop()
- {
- Print("Click Top");
- }
-
- void CAaxDlg::OnClickBottom()
- {
- Print("Click Bottom");
- }
-
- void CAaxDlg::OnClickLeft()
- {
- Print("Click Left");
- }
-
- void CAaxDlg::OnClickRight()
- {
- Print("Click Right");
- }
-
- void CAaxDlg::Print(LPCSTR str)
- {
- CString strConsole;
- GetDlgItem(IDC_EDIT)->GetWindowText(strConsole);
- strConsole = CString(str) + "\r\n" + strConsole;
- GetDlgItem(IDC_EDIT)->SetWindowText(strConsole);
- }
-